﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LigerMVC.Common
{    
    /// <summary>
    /// FilterGroup的简化版，支持几个简单条件的并且操作
    /// </summary>
    public class QueryCondition
    {
        public QueryCondition(string key, object value, QueryOperator op)
        {
            this.Key = key;
            this.Value = value;
            this.Operator = op;
        }
        public QueryCondition(string key, object value)
            : this(key, value, QueryOperator.Contains)
        {
        }
        public QueryCondition()
        {
        }
        public string Key
        {
            get;
            set;
        }

        public QueryOperator Operator
        {
            get;
            set;
        }

        public object Value
        {
            get;
            set;
        }

        public string ValueType
        {
            get;
            set;
        }
    }

    public enum QueryOperator
    {
        /// <summary>
        /// 相等
        /// </summary>
        Equal,
        /// <summary>
        /// 不相等
        /// </summary>
        NotEqual,
        /// <summary>
        /// 包括
        /// </summary>
        Contains,
        LessThanOrEqual,
        LessThan,
        GreaterThan,
        GreaterThanOrEqual,
        In,
        /// <summary>
        /// 不OK
        /// </summary>
        Like
    }


}
